import {_axios as axios} from '@/libs/request'
import moment from 'moment-timezone'
import * as crypto from 'crypto-js';

/**
 * 用户登录*/
export const login = (data) => {
    return axios({
        url: 'auth/login',
        data,
        method: 'POST',
        auth: {
            username: 'client',
            password: ''
        }
    })
}
/**
 * 用户退出*/
export const logout = (data) => {
    return axios({
        url: 'auth/logout',
        data,
        method: 'POST'
    })
}
/**
 * 测试token*/
export const testToken= (data) => {
    return axios({
        url: 'auth/testToken',
        data,
        method: 'POST'
    })
}
/**
 * 重新签发token*/

export const refreshTokenAndRetry=(refreshTokenId)=> {
    // 根据refreshToken重新补发token
    return axios({
        url: 'auth/refreshToken',
        method: 'post',
        data: {
            refreshTokenId
        }
    });
}

/**

 * */
/**
 * 小程序码登录
 * 获取微信小程序码*/
export const getWXACodeUnlimited=(data)=>{
    return axios({
        url:'/miniApp/getWXACodeUnlimited',
        method:'post',
        data
    })
}
/**
 * 小程序码登录
 * 通过小程序码携带的参数获取用户信息*/
export const getUserInfoBySceneCodeApi = (userData) => {
    return axios({
        url: '/login/getUserInfoBySceneCode',
        data: userData,
        method: 'post',
        skipDefaultErrorHandling:true
    })

}